# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=zdns
pkgver=v2.0.5.r22.gd93baa8
pkgrel=1
epoch=1
groups=('blackarch' 'blackarch-networking')
pkgdesc='Fast CLI DNS Lookup Tool.'
arch=('x86_64' 'aarch64')
url='https://github.com/zmap/zdns'
license=('Apache')
makedepends=('git' 'go')
source=("git+https://github.com/zmap/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $pkgname

  make $pkgname
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}

